<template>
	<view>
		<view class="cate-menu-box">
			<block>
				<uni-section title="发布" type="line" />
				<view class="menu-box">
					<u-grid :col="4">
						<u-grid-item v-for="(publishMenu,index) in publishMenuList" :key="index" @click="navPostPub(publishMenu.categoryId)">
							<u-icon :name="publishMenu.icon" :size="30" :customStyle="{
								paddingTop: 20+'rpx'
							}"></u-icon>
							<text class="menu-name">{{'发布'+publishMenu.categoryName}}</text>
						</u-grid-item>
					</u-grid>
				</view>
			</block>
			
			<block v-for="(cate,index) in categories" :key="index">
				<uni-section :title="cate.title" type="line" />
				
				<view class="menu-box">
					<u-grid :col="4">
						<u-grid-item v-for="(menu,menuIndex) in cate.menus" :key="menuIndex" @click="navCate(menu.id)">
							<u-icon :name="menu.icon" :size="30" :customStyle="{
								paddingTop: 20+'rpx'
							}"></u-icon>
							<text class="menu-name">{{menu.name}}</text>
						</u-grid-item>
					</u-grid>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				publishMenuList: [
					{ categoryId: '1', categoryName: '招聘', icon: 'plus' },
					{ categoryId: '2', categoryName: '个人', icon: 'plus' },
				],
				
				categories: [
					{ 
						title: '系统管理',
						menus: [
							{ id: '1', name: '用户管理', icon: 'account-fill' },
							{ id: '2', name: '部门管理', icon: 'setting-fill' },
							{ id: '3', name: '岗位管理', icon: 'heart-fill' },
						]
					},
					{
						title: '社交工具',
						menus: [
							{ id: '11', name: 'QQ', icon: 'qq-circle-fill' },
							{ id: '12', name: '微信', icon: 'weixin-circle-fill' },
						]
					}
				]
			}
		},
		methods: {
			navCate(cateId) {
				uni.navigateTo({
					url: '/pages/post/postList?cid='+cateId
				})
			},
			navPostPub(cateId) {
				uni.navigateTo({
					url: '/pages/post/postPublish?cid='+cateId
				})
			}
		}
	}
</script>

<style lang="scss">
	.menu-name {
		font-size: 14px;
		padding: 10rpx 0 20rpx 0;
		box-sizing: border-box;
	}
</style>
